package love.yuanmeng.guetcoalsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import love.yuanmeng.guetcoalsystem.pojo.Order;
import love.yuanmeng.guetcoalsystem.vo.OrderPropNameVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    @Select("SELECT e.supplier_name,o.*,p.*  " +
            "FROM guetcoal.order o , guetcoal.prop p , guetcoal.enterprise_info e  "+
            "WHERE o.prop_id =p.id AND e.enterprise_id =o.enterprise_id1 AND o.enterprise_id2=${id}  ")
    List<OrderPropNameVo> loadAllOrder(@Param("id") String id);


    @Update("UPDATE guetcoal.order " +
            "SET status=#{status}," +
            "finish_date=#{finish_date} " +
            "where order_id=#{order_id}")
    int updateOrder(@Param("status") String status,@Param("finish_date") String finish_date,@Param("order_id") String order_id);


}
